package com.bdqn.t382.sz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Printer {
    private InkBox inkBox;
    private Paper paper;

    @Autowired
    public Printer(@Qualifier("colorInkBox") InkBox inkBox, Paper paper) {
        this.inkBox = inkBox;
        this.paper = paper;
    }

    public void print(String text) {
        System.out.println("使用" + paper.getSize() + "纸张，");
        inkBox.print(text);
    }
}
